package moving2;

public class Main extends javax.swing.JPanel {
        protected javax.swing.JButton b1, b2, b3;
        protected javax.swing.JTextField tf1;

        
        public static java.awt.Container createContentPane() {            
            
            javax.swing.JPanel contentPane;
            javax.swing.JTextArea output;
            javax.swing.JScrollPane scrollPane;
            
            contentPane = new javax.swing.JPanel(new java.awt.BorderLayout());
            contentPane.setOpaque(true);
            
            output = new javax.swing.JTextArea(5, 30);
            output.setEditable(false);
            scrollPane = new javax.swing.JScrollPane(output);

            contentPane.add(scrollPane, java.awt.BorderLayout.CENTER);
            return contentPane;
            
        }        
               
        public Main() {
            b1 = new javax.swing.JButton("Increment");
            b1.setVerticalTextPosition(javax.swing.AbstractButton.CENTER);
            b1.setHorizontalTextPosition(javax.swing.AbstractButton.LEADING);
            b1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    b1ButtonActionPerformed(evt);
                }
            });            
            b2 = new javax.swing.JButton("Decrement");
            b2.setVerticalTextPosition(javax.swing.AbstractButton.CENTER);
            b2.setHorizontalTextPosition(javax.swing.AbstractButton.LEADING);
            b2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    b2ButtonActionPerformed(evt);
                }
            });  
            tf1 = new javax.swing.JTextField("70");
            add(b1);
            add(b2);
            add(tf1); 
        }
        
        protected void b1ButtonActionPerformed(java.awt.event.ActionEvent evt) {
            int cval = Integer.valueOf(tf1.getText()) + 1;
            tf1.setText(Integer.toString(cval));
            System.out.println(cval);
        }

        protected void b2ButtonActionPerformed(java.awt.event.ActionEvent evt) {
            int cval = Integer.valueOf(tf1.getText()) - 1;
            tf1.setText(Integer.toString(cval));
            System.out.println(cval);            
        }        
          
        private static void createLookAndFeel() {
            
            String lookAndFeel = null;
                    
            try {
                lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";                
                javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.OceanTheme());
                javax.swing.UIManager.setLookAndFeel(lookAndFeel); 
            }
            
            catch (ClassNotFoundException e) {
                System.err.println("Couldn't find class for specified look and feel:"
                                   + lookAndFeel);
                System.err.println("Did you include the L&F library in the class path?");
                System.err.println("Using the default look and feel.");
            } 
            
            catch (javax.swing.UnsupportedLookAndFeelException e) {
                System.err.println("Can't use the specified look and feel ("
                                   + lookAndFeel
                                   + ") on this platform.");
                System.err.println("Using the default look and feel.");
            } 
            
            catch (Exception e) {
                System.err.println("Couldn't get specified look and feel ("
                                   + lookAndFeel
                                   + "), for some reason.");
                System.err.println("Using the default look and feel.");
                e.printStackTrace();
            }
            
            javax.swing.JFrame.setDefaultLookAndFeelDecorated(true);
        
        }
        
        private static void createMainFrame() {
           
            createLookAndFeel();
            
            javax.swing.JFrame frame = new javax.swing.JFrame("Columbus Moving");
            frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);

            Main newContentPane = new Main();
            newContentPane.setOpaque(true);
            frame.setContentPane(createContentPane());
            frame.setIconImage(getFDImage());
            frame.pack();
            frame.setSize(new java.awt.Dimension(800, 600));
            frame.setJMenuBar(createMenuBar());
            frame.setVisible(true);       
        }

        public static javax.swing.JMenuBar createMenuBar() {
            javax.swing.JMenuBar menuBar;
            javax.swing.JMenu menu;
            javax.swing.JMenuItem menuItem, lgmenuItem, xtmenuItem;
            
            menuBar = new javax.swing.JMenuBar();
            
            menu = new javax.swing.JMenu("File");
            menuBar.add(menu);
            
            lgmenuItem = new javax.swing.JMenuItem("Login");
            menu.add(lgmenuItem);
            lgmenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    lgmenuItemButtonActionPerformed(evt);
                }
            });             
           
            menuItem = new javax.swing.JMenuItem("Changelog");
            menu.add(menuItem);
            
            xtmenuItem = new javax.swing.JMenuItem("Exit");
            menu.add(xtmenuItem);    
            xtmenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    xtmenuItemButtonActionPerformed(evt);
                }
            });              
            
            menu = new javax.swing.JMenu("Estimate");
            menuBar.add(menu);
            menuItem = new javax.swing.JMenuItem("New Estimate");
            menu.add(menuItem);                        
            menuItem = new javax.swing.JMenuItem("Estimator List");
            menu.add(menuItem);                        
            menuItem = new javax.swing.JMenuItem("Find Estimate");
            menu.add(menuItem);                        
            
            menu = new javax.swing.JMenu("Booked Jobs");
            menuBar.add(menu);                        
            menu = new javax.swing.JMenu("Dispatching");
            menuBar.add(menu);
            menu = new javax.swing.JMenu("Trips");
            menuBar.add(menu);
            menu = new javax.swing.JMenu("Storage");
            menuBar.add(menu);
            return menuBar;         

        }

        protected static void lgmenuItemButtonActionPerformed(java.awt.event.ActionEvent evt) {
            System.out.println("login");
        }
        
        protected static void xtmenuItemButtonActionPerformed(java.awt.event.ActionEvent evt) {
            System.exit(0);
        }        

        protected static java.awt.Image getFDImage() {
            java.net.URL imgURL = Main.class.getResource("images/gf_globe_24.png");
            if (imgURL != null) {
                return new javax.swing.ImageIcon(imgURL).getImage();
            } else {
                return null;
            }
        }

        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createMainFrame();
                }
            });
        }
}